<!DOCTYPE html>
<!-- html -->
<html>
<!-- head -->

<head>
    <title>注册</title>
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
    <!-- bootstrap-CSS -->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script type='text/javascript' src='js/jquery-2.2.3.min.js'></script>
    <!-- Custom Theme files -->
    <link href="css/menu.css" rel="stylesheet" type="text/css" media="all" />
    <!-- menu style -->
    <!--theme-style-->
    <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
    <!--//theme-style-->
    <!--meta data-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="keywords" content="" />
    <style>
    #register {
        text-align: right;
    }

    .w3-agree input {
        vertical-align: middle;
    }

    .error {
        background-color: #ec3434;
        opacity: .8;
        color: #fff;
        margin-left: 30%;
        font-size: 13px;
        padding-left: 5px;
        display: none;
    }

    p.error_apply {
        margin-left: 0px
    }

    div.w3_modal_body_grid1 {
        margin-bottom: 2px;
    }

    div.login-w3ls {
        padding: 0px 20px;
    }

    #submitAction {
        width: 90%;
        margin: 20px auto;
        background-color: #00c4da;
        padding: 10px 0px;
        font-size: 20px;
        color: #fff;
        border: 0px;
        text-align: center;
        border-radius: 10px
    }
    </style>
    <script type="text/javascript">
    function isWeixnOpen() {

        var ua = navigator.userAgent.toLowerCase();

        if (ua.match(/MicroMessenger/i) == "micromessenger") {

            return true;

        } else {

            return false;

        }

    }
    $(function() {
        if (isWeixnOpen()) {

        } else {
            // document.oncontextmenu=new Function("event.returnValue=false;");
            // document.onselectstart=new Function("event.returnValue=false;");
            // $("body").text("请在微信打开");
            // $("body").css("text-align","center");
        }
    })
    </script>
    <!-- //nav smooth scroll -->
    <!-- Calendar -->
    <link rel="stylesheet" href="css/jquery-ui.css" />
    <script src="js/jquery-ui.js"></script>
    <script>
    $(function() {
        $("#datepicker").datepicker();
    });
    </script>
    <!-- //Calendar -->
    <link rel="stylesheet" href="css/intlTelInput.css">
</head>
<!-- //head -->
<!-- body -->

<body>
   <!--  <div style="position: relative;">
        <img style="width: 100%;" src="./images/love1.png">
        <img style="position: absolute;width: 30%;top: 10px;left: 10px;" src="./images/logo.png">
    </div> -->
    <div>
        <div class="login-w3ls">
            <!--  <form id="signin"  > -->
            <label>用户名: </label>
            <input type="text" id="logo_user" name="UserName" placeholder="用户名">
            <p class="error error_apply error_seven">用户名不能为空</p>
            <p class="error error_apply error_seven_reg">用户名为中文</p>
            <label>密码:</label>
            <input type="password" id="logo_password" name="loginPassword" placeholder="密码">
            <p class="error error_apply error_eight">密码不能为空</p>
            <div class="w3ls-loginr">
                <!-- <a href="#">忘记密码?</a> -->
            </div>
            <div class="clearfix"> </div>
            <div id="submitAction">登录</button>
                <div class="clearfix"> </div>
                <!--   </form> -->
            </div>
        </div>
        <div id="msg" style="text-align: center;color: red;"></div>
        <script src="js/bootstrap.js"></script>
</body>
<script type="text/javascript">
$(function() {



    $('#submitAction').click(function() {
        // 姓名验证
        var nameReg = /^[\u4e00-\u9fa5]{0,}$/
        if ($("input[name=UserName]").val() == '') {
            $('.error_seven').css('display', 'block')
            setTimeout(function() {
                $('.error_seven').css('display', 'none')
            }, 2000)
            return
        }

        if ($("input[name=loginPassword]").val() == '') {
            $('.error_eight').css('display', 'block')
            setTimeout(function() {
                $('.error_eight').css('display', 'none')
            }, 2000)
            return
        }
        if ($("input[name=UserName]").val() !== '' && $("input[name=loginPassword]").val() !== '') {
            console.log($("input[name=UserName]").val(), $("input[name=loginPassword]").val())
            $.ajax({
                method: "get",
                url: "/member/loading.do?number="+$("input[name=UserName]").val()+"&Password="+ $("input[name=loginPassword]").val(),
                success: function(res) {
                   
                    if (res.code==400) {
                       $("#msg").text("账号或者密码错误")
                    }else if(res.code==200){
                      console.log(res)
                    $("#msg").text("")
                   window.localStorage.setItem("userInfo",JSON.stringify(res.data));
                    console.log(window.localStorage.getItem("userInfo")) 
                    window.location.href="./mine.html"
                    }
                },
                error: function(error) {
                    console.log(error)
                }
            })
        }
    })
})
</script>

</html>